<template>
	<div class="newsinfocon">
		<h3 class="newstitle">{{newsinfo.title}}</h3>
		<p class="subtitle">
			<span class="time">发表时间：{{newsinfo.add_time}}</span>
			<span class="num">点击:{{newsinfo.click}}</span>
		</p>
		<!-- 内容区 -->
		<p class="content">{{newsinfo.content}}</p>
		<!-- 评论区 -->
		<comment :id="this.id"></comment>
	</div>
</template>

<script>
	import comment from '../subcomponent/comment.vue'
	export default({
		data(){
			return {
				id:this.$route.params.id,
				newsinfo:{}
			}
		},
		created(){
			this.getNewsInfo()
		},
		methods:{
			getNewsInfo(){
			this.$http.get('http://localhost:3001/newscontent/'+this.id).then(result=>{
				if(result.body){
					this.newsinfo=result.body
				}
			})
		}
		},
	components:{
			comment
	}
	})
</script>

<style>
	.newsinfocon .newstitle{
		font: 18px "arial black";
		text-align: center;
		color: #090723;
		border-bottom: 1px dotted #000000;
	}
	.subtitle{
		display: flex;
		justify-content: space-between;
		color: #26A2FF;
	}
	.content{
		text-indent: 1em;
	}
</style>
